package leetcode;

public class l0409_最长回文串_重点 {
    public int longestPalindrome(String s) {
        int[] count = new int[128];
        int length = s.length();
        for (int i = 0; i < length; ++i) {
            char c = s.charAt(i);
            count[c]++;
        }

        int result = 0;
        for (int v : count) {
            result += v / 2 * 2;
            if (v % 2 == 1 && result % 2 == 0) {
                result++;
            }
        }
        return result;
    }

    public static void main(String[] args) {
        l0409_最长回文串_重点 dodd = new l0409_最长回文串_重点();
        int result = dodd.longestPalindrome("bananas");
        System.out.println(result);
    }

}

